package org.NooLab.glue.net;

import java.io.Serializable;
import java.util.Vector;


/**
 * 
 * a collection of {@link HostingDataItem}s, which store the association between
 * the name, the id and the network address of a client
 * 
 */
public class HostingData implements Serializable{

	private static final long serialVersionUID = 714860570471422036L;

	
	Vector<HostingDataItem> hostingData = new Vector<HostingDataItem>();
	
	
	public HostingData(){
		
	}
	
	public void add( HostingDataItem item ){
		hostingData.add(item) ;
	}
	
	public HostingDataItem get( int index ){
		HostingDataItem item = null;
		
		hostingData.get(index) ;
		
		return item;
	}
	
	public HostingDataItem getByInstanceID( int iid ){
		HostingDataItem item = null, hitem;
		
		for (int i=0;i<hostingData.size();i++){
			
			hitem = hostingData.get(i) ;
			
			if (hitem.getInstanceID() == iid){
				item = hitem;
				break;
			}
		}
		
		return item;
	}
	
	public HostingDataItem getByName( String name ){
		HostingDataItem item = null, hitem;
		
		for (int i=0;i<hostingData.size();i++){
			
			hitem = hostingData.get(i) ;
			
			if (hitem.getApplicantsName().contentEquals(name)){
				item = hitem;
				break;
			}
		}
		
		return item;
	}

	public Vector<HostingDataItem> getHostingData() {
		return hostingData;
	}

	public void setHostingData(Vector<HostingDataItem> hostingData) {
		this.hostingData = hostingData;
	}
	
	
	
}
